package HeuNavigation;

//表示地点的节点，存储相关信息
public class Node implements Comparable {

    private int index; //节点的序号
    private String name; //节点名称
    private char type; /*类型 A-教学楼/图书馆
                             B-学生公寓
                             C-食堂
                             D-体育场
                             E-医院
                         */
    private int peopleNum; //相对人流量 1-101

    //创建节点
    public Node(int index, String name, char type) {
        this.index = index;
        this.name = name;
        this.type = type;
    }

    //getterAndSetter
    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public char getType() {
        return type;
    }

    public void setType(char type) {
        this.type = type;
    }

    public int getPeopleNum() {
        return peopleNum;
    }

    public void setPeopleNum(int peopleNum) {
        this.peopleNum = peopleNum;
    }

    @Override
    public String toString() {
        String ts="";
        switch (type){
            case 'A':ts="教学楼/图书馆";
            case 'B':ts="学生公寓";
            case 'C':ts="食堂";
            case 'D':ts="体育场";
            case 'E':ts="医院";
        }
        return "地点信息： " +
                "  名称='" + name +
                ", 类型=" + ts +
                ", 相对人流量="+peopleNum;
    }


    //根据人流量多少，实现comparable
    @Override
    public int compareTo(Object o) {
        Node node=(Node)o;
        int a=this.peopleNum;
        int b= node.peopleNum;
        return a>=b?1:-1;
    }

}
